Skip to content

Conversation

@ingomueller-net
Copy link
Contributor

This PR adds the -reconcile-unrealized-casts pass to the RUN line of the tritongpu_to_llvm.mlir test. This ensures that left-over unrealized_casts ops are cleaned up, which can occur starting from llvm/llvm-project#158298, and which would otherwise break this test. Adding the pass is the recommended solution from the description of that PR.

New contributor declaration

  • I am not making a trivial change, such as fixing a typo in a comment.

  • I have written a PR description following these
    rules.

  • I have run my changes against our internal test infrastructure.

  • Select one of the following.

    • I have added tests.
      • /test for lit tests
      • /unittest for C++ tests
      • /python/test for end-to-end tests
    • This PR does not need a new test because I am only changing an existing test.
  • Select one of the following.

    • I have not added any lit tests.
    • The lit tests I have added follow these best practices,
      including the "tests should be minimal" section. (Usually running Python code
      and using the instructions it generates is not minimal.)

This PR adds the `-reconcile-unrealized-casts` pass to the `RUN` line of
the `tritongpu_to_llvm.mlir` test. This ensures that left-over
`unrealized_casts` ops are cleaned up, which can occur starting from
llvm/llvm-project#158298, and which would otherwise break this test.
Adding the pass is the recommended solution from the description of that
PR.

Signed-off-by: Ingo Müller <[email protected]>
// RUN: triton-opt %s -split-input-file --allocate-shared-memory-nv --convert-triton-gpu-to-llvm 2>/dev/null | FileCheck %s --dump-input-context 20
// RUN: triton-opt %s -split-input-file \
// RUN: --allocate-shared-memory-nv --convert-triton-gpu-to-llvm \
// RUN: --reconcile-unrealized-casts 2>/dev/null \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have quite a few tests that call --convert-triton-gpu-to-llvm why changing this is one in particular?
We are not calling this pass in our python pass manager so either is is unnecessary or we may have some problems? Or is it just getting fixed by canonicalizer?
I wonder if we should just make sure we reconcile unrealized casts at the end of our conversion passes instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, probably they are being cleaned up by some canonicalization and/or DCE pass or similar. It could also be that some test allow for additional ops because they use CHECK and not CHECK-NEXT. Finally, downstream users and tests may not have updated to that version of LLVM yet.

In any case, yes, making the reconciliation part of the conversions may be a good way to ensure that that always happens. Maybe it's also something to ask or discuss upstream; sounds cumbersome if everybody needs to do this now...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change driven by a concrete case breaking with top of tree llvm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. It breaks with the change linked in the PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants